
<div class="member_l">
    <?php if ($_GET['action'] != 'suathongtincanhan' && $_GET['action'] != 'xemanh') { ?>
        <div class="mb_l_bg" style="position: relative">
            <span class="avatar" >
                <img id="leftavatar" src="<?php
    if ($member->isOwner()) {
        echo $common->get_avatar_thumb($_SESSION['client']['avatar']);
    }else
        echo $common->get_avatar_thumb($_SESSION['mem']['avatar']);
        ?>" />
            </span>
            <?php if ($member->isOwner()) { ?>
                <div class="actiondiv" ><span class="right"><a href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>&action=suathongtincanhan&option=4"><img width="16" height="16"  alt="" src="/images/b_edit.png"></a></span><a href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>&action=suathongtincanhan&option=4">Cập nhật ảnh đại diện </a></div>
            <?php } ?>
        </div>
    <?php } ?>
    <?php if ($member->isOwner()) { ?>
        <div class="mb_l_bg">
            <ul>

                <li >
                    <a href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>&action=thongtincanhan"><span class="icon"><img alt="" src="/images/16x16/id_card.png"></span>Thông tin cá nhân</a>
                </li>
                <li>
                    <a href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>&action=suathongtincanhan&option=4"><span class="icon"><img alt="" src="/images/16x16/user.png"></span>Ảnh đại diện</a>
                </li>
                <li>
                    <a href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>&action=xemalbum"><span class="icon"><img alt="" src="/images/16x16/photo_camera.png"></span>Hình ảnh</a>
                </li>
                <li class="end have_sub_menu">
                    <a href="javascript: " onclick="slide_toogle_menu(this);return false;"><span class="icon"><img alt="" src="/images/16x16/mail.png"></span>Tin nhắn<span class="bullet"></span></a>
                    <ul class="submenu">
                        <li><a href="/thanh-vien?mid=<?php echo $_SESSION['client']['id']; ?>&action=hopthu"><span style="cursor: pointer" >Hộp thư đến</span><span  id="show-inbox-left"><span class="number-section"><span class="number-section-main" id="total-inbox-left">(0)</span></span></span></a></li>
                        <li class="end"><a href="/thanh-vien?mid=<?php echo $_SESSION['client']['id']; ?>&action=thudagui"><span style="cursor: pointer" >Hộp thư đi</span></a></li>
                    </ul>
                </li>


            </ul>
            <!--
            <div style="margin: 10px 0;float: left;text-align: center;width: 100%"><a href="/thanh-vien?mid=<?php echo $_SESSION['client']['id']; ?>&action=thongtincanhan"><img alt="" src="/images/addfriend_btn.jpg"></a></span></div>
            -->
        </div>
    <?php } else { ?>

        <div class="mb_l_bg">
            <ul>
                <li >
                    <a href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>"><span class="icon"><img alt="" src="/images/16x16/world.png"></span>Trang cá nhân</a>
                </li>
                <li >
                    <a href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>&action=thongtincanhan"><span class="icon"><img alt="" src="/images/16x16/id_card.png"></span>Xem thông tin cá nhân</a>
                </li>
                <li>
                    <a href="/thanh-vien?mid=<?php echo $_GET['mid']; ?>&action=xemalbum"><span class="icon"><img alt="" src="/images/16x16/photo_camera.png"></span>Xem ảnh</a>
                </li>
                <li>
                    <a href="javascript:showSendMsg('<?php echo $_GET['mid']; ?>');"><span class="icon"><img alt="" src="/images/16x16/mail.png"></span>Gửi tin nhắn</a>
                </li>

            </ul>
            <!--
            <div style="margin: 10px 0;float: left;text-align: center;width: 100%"><a href="/thanh-vien?mid=<?php echo $_SESSION['client']['id']; ?>&action=thongtincanhan"><img alt="" src="/images/addfriend_btn.jpg"></a></span></div>
            -->
        </div>
    <?php } ?>


    <?php
    if ($_GET['action'] == 'xemanh') {
        $rsImages = $member->getMyImageExcept(intval($_GET['mid']), intval($_GET['aid']), intval($_GET['image_id']));
        if ($db->NumRows($rsImages) > 0) {
            ?>

            <div class="container_block margintop15">
                <div class="title">Ảnh cùng album
                    <div class="pagination-top">
                        <a class="next right next-btn" href="javascript:void(0);" onclick=""></a>
                        <a class="prev left previous-btn" href="javascript:void(0);" onclick=""></a>

                    </div>
                </div>
                <ul class="block_list w180">
                    <?php while ($row = $db->FetchToArray($rsImages)) { ?>
                        <li>
                            <a class="thumb" href="<?php echo DOMAIN . '/thanh-vien?mid=' . $row['mid'] . '&aid=' . $row['aid'] . '&image_id=' . $row['id'] . '&action=xemanh'; ?>"><img src="<?php echo $common->get_img_thumb($row['image']); ?>" alt="Ảnh cùng album"></a>

                        </li>
                    <?php } ?>
                </ul>
            </div>
            <?php
        }
    }
    ?>
    <?php
    if ($_GET['action'] != 'friend') {
        $rsFriend = $member->getAllFriend(27);
        if ($db->NumRows($rsFriend) > 0) {
            ?>
            <div class="container_block margintop15 friend marginbottom15">
                <div class="title">Bạn bè 
                    <div class="pagination-top">
                        <a id="fri_next" class="next right next-btn" href="javascript:void(0);" onclick=""></a>
                        <a id="fri_prev" class="prev left previous-btn" href="javascript:void(0);" onclick=""></a>

                    </div>
                </div>
                <div class="block_list w180 friend_left">
                    <div id="friend_slide">
                        <ul >
                            <?php
                            $i = 0;
                            while ($row = $db->FetchToArray($rsFriend)) {
                                ?>
                                <li>
                                    <a  href="<?php echo DOMAIN . '/thanh-vien?mid=' . $row['id']; ?>"><img src="<?php echo $common->get_avatar_thumb($row['avatar']); ?>" title="<?php echo $row['fullname']; ?>" alt="<?php echo $row['fullname']; ?>"></a>
                                    </br><a  href="<?php echo DOMAIN . '/thanh-vien?mid=' . $row['id']; ?>"><span  title="<?php echo $row['fullname']; ?>"><?php echo $row['last_name']; ?></span></a>
                                </li>
                                <?php
                                $i++;
                                if ($i % 9 == 0) {
                                    echo '</ul><ul >';
                                }
                            }
                            if ($i % 9 > 0) {
                                echo '</ul>';
                            }
                            ?>               
                    </div>
                </div>
            </div>


            <?php
        }
    } else {
        ?>
        <div class="suggest_friend">
            <div class="title_module">
                <h5 class="hover-act-img">Có thể bạn quen</h5>
            </div>
            <div class="content_module">
                <?php
                $arrNotFriend = $member->getNotFriend(15);
                ?>
                <ul class="displaySuggest">
                    <?php
                    $num_row = $db->NumRows($arrNotFriend);
                    $max = $num_row >= 5 ? 5 : $num_row;
                    for ($i = 0; $i < $max; $i++) {
                        $row = $db->FetchToArray($arrNotFriend);
                        ?>
                        <li >
                            <a class="thumb" href="<?php echo DOMAIN . "/thanh-vien?mid=" . $row['id']; ?>"><img src="<?php echo $common->get_avatar_thumb($row['avatar']); ?>"></a>
                            <h4><a href="<?php echo DOMAIN . "/thanh-vien?mid=" . $row['id']; ?>"><?php echo $row['fullname']; ?></a></h4>
                            <p></p>
                            <span>
                                <span class="icon"><img src="/images/add-friend.png" alt="<?php echo $row['fullname']; ?>"></span>
                                <a rel="<?php echo $row['id']; ?>" alt="<?php echo $row['fullname']; ?>" class="btnAddFriend" href="javascript:void(0);">Kết bạn</a>
                                <div class="box_action">
                                    <div class="overlap"></div>
                                    <ul rel="<?php echo $row['id']; ?>" lang="<?php echo $row['groups']; ?>">
                                        <?php
                                        foreach ($arrGroup as $value) {
                                            ?>
                                            <li>
                                                <input type="checkbox" <?php if(in_array($value['id'], $arrBelongGroup)) echo "checked"; ?> id="<?php echo $value['id']; ?>"/> <?php echo $value['group_name']; ?>
                                            </li>
                                        <?php } ?>
                                        <li class="sep"></li>                                       
                                        <li class="rm"><div>Thôi không là bạn</div></li>
                                    </ul>
                                </div>
                            </span>
                            
                            <span title="Xóa" class="removeImage" onclick=""></span>
                        </li>
                    <?php } ?>

                </ul>
                <ul class="hiddenSuggest">
                    <?php
                    while ($row = $db->FetchToArray($arrNotFriend)) {
                        ?>
                        <li >
                            <a class="thumb" href="<?php echo DOMAIN . "/thanh-vien?mid=" . $row['id']; ?>"><img src="<?php echo $common->get_avatar_thumb($row['avatar']); ?>"></a>
                            <h4><a href="<?php echo DOMAIN . "/thanh-vien?mid=" . $row['id']; ?>"><?php echo $row['fullname']; ?></a></h4>
                            <p></p>
                            <span>
                                <span class="icon"><img src="/images/add-friend.png" alt="<?php echo $row['fullname']; ?>"></span>
                                <a rel="<?php echo $row['id']; ?>" alt="<?php echo $row['fullname']; ?>" class="btnAddFriend" href="javascript:void(0);">Kết bạn</a>
                            </span>
                            <span title="Xóa" class="removeImage" onclick=""></span>
                        </li>
                    <?php } ?>
                </ul>
            </div>
        </div>
        <script type="text/javascript" >
            $(".btnAddFriend").click(function(){
                showAddFriend($(this).attr("rel"));
            });
            $(".removeImage").click(function(){
                $(this).parent().remove();
                $(".displaySuggest").append($(".hiddenSuggest").find('li')[0]);
                
            });
        </script> 
        <?php
    }
    ?>
</div>
